#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>

static char buf[1024];

int main(int argc, char *argv[]) {
    for (int i = 1; i < argc; i++) {
        FILE *fp = fopen(argv[i], "r");
        if (!fp)
            continue;

        struct stat st;
        if (fstat(fileno(fp), &st) == 0 && st.st_mode == S_IFREG) {
            ssize_t byte_read;
            while ((byte_read = fread(buf, 1, 1024, fp)) > 0) {
                fwrite(buf, 1, byte_read, stdout);
            }
        }

        fclose(fp);

    }

    return 0;
}
